<template>
  <div class="clearfix">
    <el-dialog :close-on-click-modal="false" title="批量修改商品分类" :append-to-body="true" :visible.sync="showCate" width="600px" center>
      <el-form>
        <el-form-item label="商品栏目" style="margin-bottom: 0px">
          <el-col :span="14">
            <el-col :span="24" v-for="(domain, index) in formLabelAlign" :key="index">
              <el-col :span="20" class="mr">
                <el-cascader :options="cate_option" :props="optionProps" :show-all-levels="false" change-on-select style="width: 100%" v-model="domain.value" placeholder="请选择栏目"></el-cascader>
              </el-col>

              <el-col :span="1" v-if="index == 0">
                <el-button :loading="$store.state.isLoading" @click="addDomain" type="primary" icon="el-icon-plus"></el-button>
              </el-col>
              <el-col :span="1" v-if="index > 0">
                <el-button :loading="$store.state.isLoading" @click.prevent="removeDomain(domain)" type="danger" icon="el-icon-delete"></el-button>
              </el-col>
            </el-col>
          </el-col>
        </el-form-item>
        <el-form-item label="商品：">
          <el-col>
            <el-tag v-for="(tag, t) in pid_str_cn" :key="t" closable style="margin: 0 10px" @close="delPidCn(t)">
              {{ tag }}
            </el-tag>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-col class="lh size_12 sizeColor">
            <div>
              PS：选择商品相关分类，点击选择栏目左侧 "[+]"
              可增加所属分类选择器，就是指一个产品可以放在多个分类下
            </div>
          </el-col>
        </el-form-item>
        <div class="tc" style="width: 100%">
          <el-button :loading="$store.state.isLoading" type="primary" @click="changeCateBtn">
            确定
          </el-button>
        </div>
      </el-form>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" title="审核商品" :append-to-body="true" :visible.sync="check_show" width="800px" class="tl size_13">
      <el-form ref="form" label-width="120px">
        <el-form-item label="状态：">
          <el-col :span="12">
            <el-radio-group v-model="check_form.is_check">
              <el-radio label="0">未审核</el-radio>
              <el-radio label="1">已审核</el-radio>
              <el-radio label="3">驳回</el-radio>
            </el-radio-group>
          </el-col>
        </el-form-item>
        <el-form-item label="备注：">
          <el-col :span="12">
            <el-input size="small" clearable type="text" v-model="check_form.reback_msg" placeholder="请输入备注"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="check_shop_btn()">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog title="采集" :visible.sync="collect_show" width="30%" :close-on-click-modal="false">
      <el-form ref="form" :model="collectdata" label-width="80px">
        <el-form-item label="采集文本" prop="title">
          <el-col :span="24">
            <el-input v-model="collectdata.text" autocomplete="off" size="small"></el-input>
          </el-col>
          <p style="text-align: left">
            采集阿里巴巴商品，网址：https://re.1688.com/，注意必须登陆后复制链接采集才能成功
            ==》
            <a style="color: red" href="https://re.1688.com/" target="_blank">链接</a>
          </p>
        </el-form-item>
        <el-button :loading="$store.state.isLoading" @click="collect_btn" type="primary" size="small" style="margin-left: 10px">采集</el-button>
      </el-form>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" title="上传视频" :append-to-body="true" :visible.sync="dialogFormVisible">
      <uploadVideo @send_url="rev_send_url" :pro_src="formVideo.video" v-if="dialogFormVisible"></uploadVideo>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" title="二维码" class="tc" :append-to-body="true" :visible.sync="ewmdio" width="370px" center>
      <iframe :src="qr_url" width="75%" height="250" frameborder="0" class="iframe_img"></iframe>
      <span slot="footer" class="dialog-footer">
        <el-button :loading="$store.state.isLoading" @click="ewmdio = false">取 消</el-button>
      </span>
    </el-dialog>

    <el-dialog :close-on-click-modal="false" title="复制商品" :modal-append-to-body="false" :visible.sync="copy_show" class="tl size_13" width="800px">
      <el-form ref="data" class="mar_top" label-width="150px">
        <el-form-item label="商品分类选择：">
          <el-cascader :options="cate_option" :props="optionProps" :show-all-levels="false" v-model="copy_form.cate_id" size="small" change-on-select placeholder="商品分类" clearable></el-cascader>
        </el-form-item>

        <el-form-item>
          <el-button :loading="$store.state.isLoading" size="medium" type="primary" @click.prevent="copy_shop_btn()">复制</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :title="activity_title" class="tl size_13" width="800px" :visible.sync="activity_show">
      <el-form ref="form" label-width="150px">
        <el-form-item label="活动场景：">
          <el-col :span="12">
            <el-select v-model="activity_form.types" size="small" clearable placeholder="请选择" style="width: 100%" @change="sel_event">
              <el-option v-for="(item, k) in activity_option" :key="k" :label="item" :value="k"></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <template v-if="activity_form.types == '3'">
          <el-form-item label="砍价次数：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.bargain_number" placeholder="请输入砍价次数">
              </el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="单次最低砍价价格：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.bargain_begin" placeholder="请输入最低砍价价格">
              </el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="单次最高砍价价格：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.bargain_end" placeholder="请输入最高砍价价格">
              </el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="最多累计砍价金额：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.bargain_price" placeholder="请输入最多累计砍价金额">
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="时间期限（小时）：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.bargain_time" placeholder="请输入砍价时间期限">
              </el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
        </template>
        <template v-else-if="activity_form.types == '4'">
          <el-form-item label="拼团人数：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.group_people" placeholder="请输入拼团人数">
              </el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="拼团折扣：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.group_discount" placeholder="请输入拼团折扣">
                <span slot="append">折</span>
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="拼团时间：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.group_time" placeholder="请输入拼团时间">
                <span slot="append">小时</span>
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="团长免单：">
            <el-col :span="12">
              <el-radio-group v-model="activity_form.group_face">
                <el-radio label="0">否</el-radio>
                <el-radio label="1">是</el-radio>
              </el-radio-group>
            </el-col>
          </el-form-item>
        </template>
        <template v-else-if="activity_form.types == '2'">
          <el-form-item label="消耗积分：">
            <el-col :span="12">
              <el-input size="small" clearable v-model="activity_form.score_rob" placeholder="请输入消耗积分"></el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="所属分类：">
            <el-col :span="12">
              <el-select v-model="activity_form.integral_cate" size="small" clearable placeholder="请选择" style="width: 100%">
                <el-option v-for="(item, i) in integralCateLists" :key="i" :label="item.title" :value="item.id"></el-option>
              </el-select>
            </el-col>
          </el-form-item>
        </template>
        <template v-else-if="activity_form.types == '7'">
          <el-form-item label="商品折扣：" v-show="activity_form.types == '7'">
            <el-col :span="12">
              <el-input size="small" clearable v-model="activity_form.discount_rob" placeholder="请输入商品折扣">
                <span slot="append">折</span>
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="商品数量：" v-show="activity_form.types == '7'">
            <el-col :span="12">
              <el-input size="small" clearable v-model="activity_form.discount_limit" placeholder="请输入活动商品数量"></el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="选择时区：" v-show="activity_form.types == '7'">
            <el-col :span="12">
              <el-select v-model="activity_form.time_id" size="small" clearable placeholder="请选择" style="width: 100%">
                <el-option v-for="(item, i) in time_option" :key="i" :label="item.time_str" :value="item.id"></el-option>
              </el-select>
            </el-col>
          </el-form-item>
        </template>
        <template v-else-if="activity_form.types == '8'">
          <el-form-item label="公排权值：" v-show="activity_form.types == '8'">
            <el-col :span="12">
              <el-input size="small" clearable v-model="activity_form.platoon" placeholder="请输入赠送的公排权值"></el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
        </template>

        <template v-else-if="activity_form.types == '6'">
          <el-form-item label="定金：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.down_pay" placeholder="请输入定金"></el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
          <el-form-item label="发货期：">
            <el-col :span="12">
              <el-date-picker v-model="delivery" type="date" size="small" placeholder="选择日期" style="width: 100%"></el-date-picker>
            </el-col>
          </el-form-item>
          <el-form-item label="预售阶梯：">
            <el-col :span="12" v-for="(item, k) in presale" :key="k">
              <el-col :span="8">
                <el-input size="small" clearable type="number" v-model="item.ladder_num" placeholder="请输入单数"></el-input>
              </el-col>
              <el-col :span="2">--</el-col>
              <el-col :span="8">
                <el-input size="small" clearable type="number" v-model="item.ladder_money" placeholder="请输入预售价" @blur="lose_laddermoney(k, item.ladder_money)"></el-input>
              </el-col>
              <el-col :span="4" v-show="k + 1 == presale.length ? true : false">
                <el-button :loading="$store.state.isLoading" size="small" type="primary" style="margin-left: 15px" @click="add_presale">增加</el-button>
              </el-col>
            </el-col>
          </el-form-item>
        </template>

        <template v-else-if="activity_form.types == '10' || activity_form.types == '11'">
          <el-form-item label="核销次数：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.write_number" placeholder="请输入核销次数">
                <span slot="append">次</span>
              </el-input>
            </el-col>
          </el-form-item>

          <el-form-item label="励核金额：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.bargain_begin" placeholder="请输入每次核销奖励核销人金额">
                <span slot="append">元</span>
              </el-input>
            </el-col>
          </el-form-item>
        </template>

        <!-- 竞拍 -->
        <template v-else-if="activity_form.types == 18 || activity_form.types == '18'">
          <el-form-item label="竞拍方式：">
            <el-col :span="8">
              <el-radio-group v-model="activity_form.auction_types">
                <el-radio label="0">提价拍</el-radio>
                <el-radio label="1">降价拍</el-radio>
              </el-radio-group>
            </el-col>
            <el-col :span="16">
              提价拍：起拍价需小于流拍价 | 降价拍：起拍价需大于流拍价
            </el-col>
          </el-form-item>

          <el-form-item label="加减幅度价格：">
            <el-col :span="8">
              <el-input size="small" clearable type="number" v-model="activity_form.auction_amplitude" placeholder="最低加减幅度">
              </el-input>
            </el-col>
            <el-col :span="1" style="text-align: center"> ~ </el-col>
            <el-col :span="8">
              <el-input size="small" clearable type="number" v-model="activity_form.auction_amplitude_max" placeholder="最高加减幅度">
              </el-input>
            </el-col>
            <span style="padding-left: 10px">元</span>
          </el-form-item>

          <el-form-item label="起拍价：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.starting_price" placeholder="请输入起拍价">
                <span slot="append">元</span>
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="流拍价：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.auction_price" placeholder="请输入流拍价">
                <span slot="append">元</span>
              </el-input>
            </el-col>
          </el-form-item>

          <el-form-item label="保证金：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.auction_margin" placeholder="请输入保证金">
              </el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>

          <el-form-item label="开始时间：">
            <el-col :span="12">
              <el-date-picker size="small" v-model="auction_open_time" type="datetime" style="width: 100%" placeholder="选择开始时间">
              </el-date-picker>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>

          <el-form-item label="结束时间：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.auction_end_time" placeholder="请输入结束时间">
                <span slot="append">分钟</span>
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="下一轮开始时间：">
            <el-col :span="12">
              <el-input size="small" clearable type="number" v-model="activity_form.auction_next_time" placeholder="请输入下一轮开始时间">
                <span slot="append">分钟</span>
              </el-input>
            </el-col>
          </el-form-item>
        </template>

        <!-- 拼购 -->
        <template v-else-if="activity_form.types == '19'">
          <el-form-item label="拼购分类：">
            <el-col :span="12">
              <el-select v-model="activity_form.gbc_id" size="small" clearable placeholder="请选择" style="width: 100%">
                <el-option v-for="(item, i) in groupbuyCateList" :key="i" :label="item.title" :value="item.id"></el-option>
              </el-select>
            </el-col>
          </el-form-item>
        </template>
        <!-- 零元购 -->
        <template v-else-if="activity_form.types == '24'">
          <el-form-item label="邮费：">
            <el-col :span="12">
              <el-input size="small" clearable v-model="activity_form.zeromail" placeholder="请输入零元购邮费"></el-input>
              <!-- <span style="padding-left: 10px"></span> -->
            </el-col>
          </el-form-item>
        </template>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="add_activity_submit()">添 加</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <tableComponents :pagination="{ currentPage: currentPage1, pageSize, total: list.all_num }" @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange" @sendUserSearch="getSearch" :searchData="userSearchData" :isHaveExport="false" @toAdd="add">
      <template v-slot:headRight>
        <div class="fx head-right-icon" v-if="is_cj && is_cj.sjcj && is_cj.sjcj.is_open != 0">
          <p @click="collect_flag">
            <i class="el-icon-goods" />
            &nbsp;&nbsp;采集
          </p>
        </div>
        <div class="fx head-right-icon">
          <p @click="exportShop">
            <i class="el-icon-upload" />
            &nbsp;&nbsp;导出商品
          </p>
        </div>
        <div class="fx head-right-icon">
          <p @click="$router.push('/index/shop/product_import')">
            <i class="el-icon-upload" />
            &nbsp;&nbsp;导入商品
          </p>
        </div>
      </template>
      <template v-slot:searchBottom>
        <el-form class="search_prod search_prod1" label-width="94px">
          <el-form-item label="商品类型">
            <el-row class="tl mar_bottom_15">
              <el-radio-group v-model="cate" size="small" class="tl money-group">
                <el-radio-button v-for="(item, i) in prodType" :label="item.iden" :key="i">{{ item.title }}</el-radio-button>
              </el-radio-group>
            </el-row>
          </el-form-item>
        </el-form>
      </template>
      <template v-slot:table>
        <el-table ref="multipleTable" stripe v-loading="loading" header-row-class-name="head_color" :data="list.data" tooltip-effect="dark" style="width: 99.8%" :default-sort="{ prop: 'sort' }" @selection-change="handleSelectionChange">
          <el-table-column type="selection" class="tc" width="35"></el-table-column>
          <el-table-column prop="sort" sortable :sort-method="sorta" label="排序" min-width="80">
            <template slot-scope="scope">
              <el-input @change="sortNew(scope.$index, scope.row)" v-model.number="scope.row.sort" autocomplete="off" size="small"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="picture" header-align="center" align="center" width="220px" label="图片">
            <template slot-scope="scope">
              <el-popover placement="right" title trigger="hover">
                <img :src="scope.row.piclink" style="width: 500px" />
                <img slot="reference" :src="scope.row.piclink" :alt="scope.row.piclink" style="width: 100px" />
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column label="商品信息" min-width="400">
            <template slot-scope="scope" style="vertical-align: text-top">
              <div class="tab_div">
                <div>
                  <span>商品标题：</span>
                  <span>{{ scope.row.title }}</span>
                  <br />
                  <span style="font-weight: bold">商品分类：</span>
                  <span>{{ scope.row.cate_title }}</span>
                  <br />
                  <div v-if="scope.row.label && scope.row.label.length > 0">
                    <span>商品标签：</span>
                    <el-tag v-for="(label, l) in scope.row.label" style="margin-right: 5px; color: #ffffff; margin-left: 0" size="mini" :key="l" effect="dark">{{ label }}</el-tag>
                  </div>
                  <div v-if="
                      $store.state.plugin &&
                      $store.state.plugin.lswm &&
                      $store.state.plugin.lswm.is_open == 1 &&
                      scope.row.sid > 0 &&
                      scope.row.tags &&
                      scope.row.tags.length > 0
                    ">
                    <span>连锁标签：</span>
                    <span class="lswm_tag" v-for="(tag, t) in json_to_arr(scope.row.tags)" :key="t" :style="{ color: tag.c, background: tag.b }">
                      {{ tag.n }}
                    </span>
                  </div>
                </div>
                <div v-if="scope.row.is_exchange == '1'">
                  <span class="rat">积分兑换</span>
                </div>
                <div v-if="scope.row.is_publicflat == '1'">
                  <span class="rat mar_lf_15">公排</span>
                </div>
                <div v-if="$route.path.indexOf('suppliershops') >= 0">
                  <span>供应商账号：</span>
                  <span>{{ scope.row.sid_username }}</span>
                </div>
                <div v-if="
                    $route.path.indexOf('suppliershops') >= 0 &&
                    scope.row.sid_nickname
                  ">
                  <span>供应商昵称：</span>
                  <span>{{ scope.row.sid_nickname }}</span>
                </div>
                <div v-if="
                    $route.path.indexOf('suppliershops') >= 0 &&
                    scope.row.shop_title != ''
                  ">
                  <span>店铺昵称：</span>
                  <span>{{ scope.row.shop_title }}</span>
                </div>
                <div v-if="
                    $route.path.indexOf('suppliershops') >= 0 &&
                    scope.row.reback_msg != ''
                  ">
                  <span>不通过原因：</span>
                  <span>{{ scope.row.reback_msg }}</span>
                </div>
                <div v-show="scope.row.admin_account">
                  <span>上传管理员：</span>
                  <span>{{ scope.row.admin_account }}</span>
                </div>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="售价" min-width="120">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>售价：</span>
                  <span>{{ scope.row.price }}</span>
                </div>
                <div v-if="
                    $store.state.plugin.jh &&
                    $store.state.plugin.jh.is_open == 1
                  ">
                  <span>批发价：</span>
                  <span>{{ $fnc.toFixedZ(scope.row.trade_price) }}</span>
                </div>
                <div>
                  <span>成本价：</span>
                  <span>{{ scope.row.cost_price }}</span>
                </div>
                <div>
                  <span>PV值：</span>
                  <span>{{ scope.row.pv }}</span>
                </div>
              
              </div>
            </template>
          </el-table-column>

          <el-table-column label="商品信息" min-width="120">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>浏览量：</span>
                  <span>{{ scope.row.views }}</span>
                </div>
                <div>
                  <span>真实销量：</span>
                  <span>{{ scope.row.real_sale }}</span>
                </div>
                <div>
                  <span>库存总量：</span>
                  <span>{{ scope.row.stock }}</span>
                </div>
                <div>
                  <span>赠送积分：</span>
                  <span>{{ scope.row.send_score }}</span>
                </div>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="是否置顶" v-if="!item.is_check" min-width="130" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-switch class="zdySwith" :width="82" v-model="scope.row.is_top" active-color="#1aad19" inactive-color="#ffffff" active-text="置顶" inactive-text="未置顶" active-value="1" @change="getIstop($event, scope.row)" inactive-value="0"></el-switch>
            </template>
          </el-table-column>

          <el-table-column label="是否审核" min-width="130" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-switch class="zdySwith" :width="82" v-model="scope.row.is_check" active-color="#13ce66" inactive-color="#ffffff" active-text="审核" inactive-text="未审核" active-value="1" @change="getIskeck($event, scope.row)" inactive-value="0"></el-switch>
            </template>
          </el-table-column>

          <el-table-column label="操作" min-width="215">
            <template slot-scope="scope">
              <el-row class="myblank">
                <el-dropdown @command="handleCommand">
                  <el-button type="primary" plain size="mini">
                    操作
                    <i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item :command="toObj(scope.row, '编辑')">编辑</el-dropdown-item>
                    <el-dropdown-item :command="toObj(scope.row, '删除')">删除</el-dropdown-item>
                    <el-dropdown-item :command="toObj(scope.row, '复制')">复制</el-dropdown-item>
                    <!-- <el-button style="padding: 7px 20px;" type="warning" plain :loading="$store.state.isLoading"
                        v-if="is_cj && is_cj.yspdb.is_open != 0" @click="uploadVideo(scope.row.id, scope.row.video)" size="mini">短视频</el-button> -->
                    <el-dropdown-item v-if="is_cj && is_cj.yspdb && is_cj.yspdb.is_open != 0" :command="toObj(scope.row, '短视频')">短视频
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>

                <el-dropdown @command="handleCommand">
                  <el-button type="primary" plain size="mini">
                    推广
                    <i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item :command="toObj(scope.row, '二维码')">二维码</el-dropdown-item>
                    <el-dropdown-item :command="toObj(scope.row, '产品链接')">产品链接</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>

                <el-dropdown @command="handleCommand">
                  <el-button type="warning" plain size="mini">
                    促销
                    <i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <!-- <el-dropdown-item :command="toObj(scope.row, '添加促销')"
                      >添加促销</el-dropdown-item
                    > -->
                    <el-dropdown-item :command="toObj(scope.row, '移动促销')">移动促销</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>

                <el-dropdown @command="handleCommand">
                  <el-button type="success" plain size="mini">
                    进销
                    <i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item :command="toObj(scope.row, '入库')">
                      入库
                    </el-dropdown-item>
                    <el-dropdown-item :command="toObj(scope.row, '调拨')" v-if="
                        is_lifting_stock == 1 ||
                        ($store.state.plugin &&
                          $store.state.plugin.qsps &&
                          $store.state.plugin.qsps.is_open == 1) ||
                        ($store.state.plugin &&
                          $store.state.plugin.qyyy &&
                          $store.state.plugin.qyyy.is_open == 1)
                      ">
                      调拨
                    </el-dropdown-item>
                    <el-dropdown-item :command="toObj(scope.row, '退货')">
                      退货
                    </el-dropdown-item>
                    <el-dropdown-item :command="toObj(scope.row, '记录')">
                      记录
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>

                <el-button :loading="$store.state.isLoading" v-if="$route.path.indexOf('suppliershops') >= 0" size="mini" plain type="warning" @click="check_supplier_shop(scope.row)">审核</el-button>
              </el-row>
            </template>
          </el-table-column>
        </el-table>
      </template>
      <template v-slot:footerLeft>
        <el-button :loading="$store.state.isLoading" type="success" size="mini" @click="changeCate">
          修改分类
        </el-button>
        <el-button :loading="$store.state.isLoading" v-if="item.show == '1'" type="primary" size="mini" @click="upShow('0')">
          下架
        </el-button>
        <el-button :loading="$store.state.isLoading" v-if="item.show == '0'" type="primary" size="mini" @click="upShow('1')">
          上架
        </el-button>
        <el-button :loading="$store.state.isLoading" v-if="item.is_check" type="primary" size="mini" @click="upischeckAll">
          审核
        </el-button>
        <el-button :loading="$store.state.isLoading" type="primary" size="mini" @click="deleteLises">
          删除
        </el-button>
      </template>
    </tableComponents>
  </div>
</template>
<script>
import uploadVideo from "@/components/currency/uploadvideo";
import { productSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  data() {
    return {
      auction_open_time: "",
      userSearchData: productSearchData,
      cate_option: [],
      optionProps: {
        value: "id",
        label: "title",
        children: "z",
      },
      copy_form: {
        id: "",
        cate_id: Number,
      },
      copy_show: false,
      check_form: {
        is_check: null,
        reback_msg: "",
      },
      check_show: false,
      presale: [
        {
          ladder_num: "",
          ladder_money: "",
          finish_per: 0,
        },
      ],
      delivery: "",
      activity_title: "添加到活动商品",
      qr_url: "",
      activity_form: {
        id: "",
      },

      activity: "", //活动场景
      time_option: [], //时区
      activity_option: {}, //活动场景
      activity_show: false,
      is_cj: "",
      shop_href: "",
      collectdata: {
        text: "",
      },
      collect_show: false,
      loading: false,
      currentPage1: 1,
      list: this.$store.state.shopSlist,
      pageSize: 10,
      multipleSelection: [],
      sort: "",
      Video: "",
      formVideo: {
        video: "",
        video_pic: "",
        id: "",
      },
      dialogFormVisible: false,
      videoFlag: false, //刚开始的时候显示为flase
      videoUploadPercent: "0%", //进度条刚开始的时候为0%
      item: {
        show: this.$route.query.show || "1",
        sid: this.$route.query.sid || "",
      },
      searchAll: {
        show: this.$route.query.show,
        sid: this.$route.query.sid || "",
        stock: this.$route.query.stock,
      },
      ewmdio: false,
      acIndex: "1",
      cate: "1",
      groupbuyCateList: {},
      integralCateLists: {},
      pid_str: [],
      pid_str_cn: [],
      showCate: false,
      formLabelAlign: [{ value: [] }],
      is_lifting_stock: 0,
    };
  },
  components: {
    uploadVideo,
  },

  methods: {
    json_to_arr(val) {
      try {
        var obj = JSON.parse(JSON.stringify(val));
        return JSON.parse(obj);
      } catch {
        return [];
      }
    },
    changeCateBtn() {
      this.$swal({
        title: "您确定要修改这些商品的分类吗",
        text: "请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要修改",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = {};
          data.pid_str = this.pid_str.join("@");
          var cate_Arr = this.formLabelAlign;
          var cate_ar = [];
          for (var i in cate_Arr) {
            cate_ar.push(cate_Arr[i].value[cate_Arr[i].value.length - 1]);
          }
          data.cate_ar = cate_ar.join("@");
          this.$api.getShops.product_saveedit_cate(data).then((res) => {
            if (res.data.code == 200) {
              this.showCate = false;
              this.pid_str = "";
              this.pid_str_cn = "";
              this.$swal("修改成功！", "您已经删除了这些信息。", "success");
              this.$store.dispatch("getShopsAll", this.searchAll);
            } else {
              this.$swal("修改失败！", res.data.result, "error");
            }
          });
        }
      });
    },
    addDomain() {
      this.formLabelAlign.push({
        value: [],
        key: Date.now(),
      });
    },
    removeDomain(item) {
      var index = this.formLabelAlign.indexOf(item);
      if (index !== -1) {
        this.formLabelAlign.splice(index, 1);
      }
    },
    delPidCn(index) {
      this.pid_str.splice(index, 1);
      this.pid_str_cn.splice(index, 1);
    },
    changeCate() {
      var str = [];
      var str1 = [];
      if (this.multipleSelection.length <= 0) {
        this.$message.error("未选择批量删除");
      } else {
        var params = {};
        params.parent_id = "";
        this.$api.getShops.getProductCateTreeList(params).then((res) => {
          if (res.data.code == 200 && res.data.status == 1 && res.data.result) {
            this.cate_option = res.data.result;
          }
        });
        for (var i in this.multipleSelection) {
          str.push(this.multipleSelection[i].id);
          str1.push(this.multipleSelection[i].title);
        }
        // str = str.slice(0, -1);
        this.pid_str = str;
        this.pid_str_cn = str1;
        this.showCate = true;
      }
    },
    exportShop() {
      var params = {};
      params = this.searchAll;
      if (this.$route.path.indexOf("supplierorder") >= 0) {
        params.is_supplier = 1;
      }
      this.$fnc.postExcelFile(params, "/api/admin/export/excel_out_product");
    },
    toObj(obj, str) {
      obj = obj || {};
      obj = JSON.parse(JSON.stringify(obj));
      obj.commandStr = str;
      return JSON.parse(JSON.stringify(obj));
    },
    handleCommand(command) {
      var str = command.commandStr;
      switch (str) {
        case "编辑":
          this.updateNews(command.id);
          break;
        case "删除":
          this.deleteShopItem(command.id);
          break;
        case "复制":
          this.copyproduct(command.id);
          break;
        case "二维码":
          this.ewm_show(command.qr);
          break;
        case "产品链接":
          this.toQianTai(command.id);
          break;
        case "添加促销":
          this.addactivity(command.id);
          break;
        case "移动促销":
          this.moveactivity(command.id);
          break;
        case "短视频":
          this.uploadVideo(command.id, command.video);
          break;
        case "入库":
          this.$store.commit("addbreadcrumbs", {
            title: "操作入库",
            url: `/index/shop/operation_stock?pid=` + command.id,
          });
          this.$router.push({
            path: "/index/shop/operation_stock",
            query: {
              pid: command.id,
            },
          });
          break;
        case "调拨":
          this.$store.commit("addbreadcrumbs", {
            title: "库存调拨",
            url: `/index/shop/allocation_stock?pid=` + command.id,
          });
          this.$router.push({
            path: "/index/shop/allocation_stock",
            query: {
              pid: command.id,
            },
          });
          break;
        case "退货":
          this.$store.commit("addbreadcrumbs", {
            title: "退货管理",
            url: `/index/shop/refund_stock?pid=` + command.id,
          });
          this.$router.push({
            path: "/index/shop/refund_stock",
            query: {
              pid: command.id,
            },
          });
          break;
        case "记录":
          this.$store.commit("addbreadcrumbs", {
            title: "流水记录",
            url: `/index/shop/product_stock?pid=` + command.id,
          });
          this.$router.push({
            path: "/index/shop/product_stock",
            query: {
              pid: command.id,
            },
          });
          break;
      }
    },
    getProductList() {
      var params = {};
      params.parent_id = "";
      this.$api.getShops.getProductCateTreeList(params).then((res) => {
        if (res.data.code == 200 && res.data.status == 1 && res.data.result) {
          this.$store.commit("setShopCateList", res.data.result);
        }
      });
    },
    getInfo(iddex) {
      var obj = {};
      if (iddex == "1") {
        obj.show = "1";
        obj.stock = "";
        obj.is_check = "1";
      } else if (iddex == "2") {
        obj.stock = 0;
        obj.show = "";
      } else if (iddex == "3") {
        obj.show = "0";
        obj.stock = "";
      } else if (iddex == "4") {
        obj.is_check = "0";
      } else if (iddex == "5") {
        obj.is_check = "3";
      } else if (iddex == "6") {
        obj.is_all = "1";
      }
      if (this.$route.path.indexOf("suppliershops") >= 0) {
        obj.is_supplier = 1;
      }
      console.log(obj);
      this.getItem(obj);
      this.acIndex = iddex;
    },
    copy_shop_btn() {
      var params = {};
      params.id = this.copy_form.id;
      params.cate_id =
        this.copy_form.cate_id[this.copy_form.cate_id.length - 1];

      this.$api.getShops.coprPouduct(params).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess({ text: "复制成功" });
          this.cate = 2;
          // var paramsss = this.searchAll;
          // paramsss.page = "";
          // paramsss.page_size = this.pageSize;
          // this.$store.dispatch("getShopsAll", paramsss);
          this.copy_show = false;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    copyproduct(id) {
      var params = {};
      params.parent_id = "";
      this.$api.getShops.getProductCateTreeList(params).then((res) => {
        if (res.data.code == 200 && res.data.status == 1 && res.data.result) {
          this.cate_option = res.data.result;
        }
      });
      this.copy_form.id = id;
      this.copy_form.cate_id = "";
      this.copy_show = true;
    },
    check_shop_btn() {
      var params = this.check_form;
      this.$api.getSupplier.reback_suppliershop(params).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("修改成功");
          this.check_show = false;
          this.check_form = {
            id: null,
            is_check: null,
            reback_msg: "",
          };
          this.$store.dispatch("getShopsAll", this.searchAll);
        } else {
          this.$fnc.alertError(res.data.result);
        }
      });
    },
    check_supplier_shop(item) {
      this.check_form = {
        is_check: null,
        reback_msg: "",
      };
      this.check_form.id = item.id;
      this.check_form.is_check = item.is_check;
      this.check_form.reback_msg = item.reback_msg;
      this.check_show = true;
    },
    lose_laddermoney(l, money) {
      if (Number(money) <= this.activity_form.down_pay) {
        this.$fnc.alertError("预售价不能小于定金");
        this.presale[l].ladder_money = this.activity_form.down_pay;
      }
    },
    add_presale() {
      var obj = {
        ladder_num: "",
        ladder_money: "",
        finish_per: 0,
      };
      this.presale.push(obj);
    },
    moveactivity(id) {
      this.activity_title = "移动到活动商品";
      this.activity_form.id = id;
      this.activity_form.is_mobile = 1;
      this.activity_show = true;
    },
    uploadVideo(id, video) {
      this.dialogFormVisible = true;
      this.formVideo.id = id;
      this.formVideo.video = video || "";
    },
    rev_send_url(val) {
      var params = {};
      this.formVideo.video = val.video_url;
      this.formVideo.video_pic = val.video_pic;
      this.formVideo.vid = val.video_id;
      params = this.formVideo;
      this.$api.getShops.setVideo(params).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess({ text: "提交成功" });
          this.dialogFormVisible = false;
          this.$store.dispatch("getShopsAll", this.searchAll);
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    ewm_show(qr) {
      this.ewmdio = true;
      this.qr_url = qr;
      console.log(qr, "yyyyyyyyyyyyy");
    },
    sel_event(val) {
      if (val == 2) {
        this.$api.getShops.integral_cate_lists_all({}).then((res) => {
          if (res.data.code == 200) {
            this.integralCateLists = res.data.result;
          }
        });
      }
      if (val == 19) {
        this.$api.getGroupbuy.getGroupbuyCateAll({}).then((res) => {
          if (res.data.code == 200) {
            this.groupbuyCateList = res.data.result;
          }
        });
      }
      if (val == 4) {
        this.$set(this.activity_form, "group_face", "0");
      }
      if (val == 7) {
        this.$api.getShops.get_limittime({}).then((res) => {
          if (res.data.code == 200) {
            this.time_option = res.data.result;
            this.time_option.forEach((item) => {
              var str1 = this.getTimeFormat(item.begin_time);
              var str2 = this.getTimeFormat(item.end_time);
              item.time_str = str1 + "---" + str2;
            });
          }
        });
      }
      for (var k in this.activity_option) {
        val == k ? (this.activity = this.activity_option[k]) : "";
      }
    },
    get_activity_option() {
      this.$api.getShops.get_activitylist({}).then((res) => {
        if (res.data.code == 200) {
          this.activity_option = res.data.result;
        }
      });
    },
    getTimeFormat(time) {
      //time 1398250549490
      //时间数字转2014-04-23 18:55:49 格式
      // php 后端时间戳返回10位数，补3个 000
      if (time == "0" || time == "0000") {
        return "----";
      }
      time = time + "";
      var date = "";
      if (time.length >= 13) {
        date = new Date(parseInt(time));
      } else {
        date = new Date(parseInt(time + "000"));
      }
      var Y = date.getFullYear() + "-";
      var M =
        (date.getMonth() + 1 < 10
          ? "0" + (date.getMonth() + 1)
          : date.getMonth() + 1) + "-";
      var D =
        (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
      var h =
        (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
      var m =
        (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
        ":";
      var s =
        date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
      return Y + M + D + h + m + s;
    },
    add_activity_submit() {
      var params = this.activity_form;
      if (this.activity_form.types == 6) {
        var flag = false;
        this.presale.forEach((item) => {
          if (Number(item.ladder_money) <= this.activity_form.down_pay) {
            this.$fnc.alertError("预售价不能小于定金");
            flag = true;
          }
        });
        if (flag) {
          return;
        }
        params.ladder = JSON.stringify(this.presale);
      }

      this.$api.getShops.add_event(params).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("添加成功");
          this.$router.push({
            path: "/index/shop/event",
            query: { action: this.activity_form.types },
          });
        } else {
          this.$fnc.alertError(res.data.result);
        }
      });
    },
    addactivity(id) {
      this.activity_title = "添加到活动商品";
      this.activity_form.id = id;
      this.activity_show = true;
    },
    sorta(a, b) {
      return b - a;
    },
    sortNew(index, row) {
      var params = {};
      params.id = row.id;
      params.sort = row.sort;
      this.$api.getShops.sortProduct(params).then((res) => {
        if (res.data.code == 200 && res.data.result) {
          return;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result); //失败弹出框
        }
      });
    },
    collect_btn() {
      //采集按钮
      var url = this.collectdata.text;
      this.$api.getShops.collect({ web: url }).then((res) => {
        if (res.data.code == 200) {
          if (res.data.result) {
            // if (typeof res.data.result == "object") {
            // this.shop_href = res.data.result[1];
            sessionStorage.setItem("title", this.$store.state.title);
            sessionStorage.setItem(
              "parentTitle",
              this.$store.state.parentTitle
            );
            let routeData = this.$router.resolve({
              path: "/index/shop/addproduct",
              query: { id: res.data.result },
            });
            window.open(routeData.href, "_blank");
            // } else {
            //   this.shop_href = res.data.result;
            // }

            this.$fnc.alertSuccess({ text: "采集成功" });
          } else {
            this.$fnc.alertError("采集失败");
          }
        } else {
          this.$fnc.alertError("采集失败");
          this.collect_show = false;
        }
      });
    },
    showToast() {
      if (this.collectdata.text) {
        this.$fnc.alertError("操作错误", "请先点击采集按钮");
      } else {
        this.$fnc.alertError("操作错误", "采集链接为空");
      }
    },
    collect_flag() {
      this.collectdata.text = "";
      this.collect_show = !this.collect_show;
    },

    getItem(obj) {
      this.loading = true;
      this.item = obj;
      for (var i in this.item) {
        obj[i] = this.item[i];
      }
      this.searchAll = obj;
      var _this = this;
      if (this.$route.query.page) {
        this.$store.dispatch("getShopsAll", this.searchAll).then(function () {
          _this.loading = false;
        });
      } else {
        this.$router.push(this.$route.path + "?page=" + 1);
      }
    },
    getSearch(obj) {
      this.loading = true;
      for (var i in this.item) {
        obj[i] = this.item[i];
      }
      this.searchAll = obj;
      var _this = this;
      if (this.$route.query.page) {
        this.$store.dispatch("getShopsAll", this.searchAll).then(function () {
          _this.loading = false;
        });
      } else {
        this.$router.push(this.$route.path + "?page=" + 1);
      }
    },
    add() {
      this.$store.commit("setShopsItemId", "");
      //   this.$router.push("/index/shop/addproduct");
      sessionStorage.setItem("title", this.$store.state.title);
      sessionStorage.setItem("parentTitle", this.$store.state.parentTitle);
      let routeData = this.$router.resolve({
        path: "/index/shop/addproduct",
      });
      window.open(routeData.href, "_blank");
    },
    toQianTai(id) {
      var url = this.$store.state.phoneAddress;
      // window.open(url + "/pages/shop/shopdetail/shopdetail?id=" + id, "_blank");
      var span = url + "/pages/shop/shopdetail/shopdetail?id=" + id;
      var oInput = document.createElement("input");
      oInput.value = span;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$fnc.alertError("复制成功", span, "success");
    },
    beforeUploadVideo(file) {
      //视频上传之前判断他的大小
      const isLt10M = file.size / 1024 / 1024 < 100;
      if (!isLt10M) {
        this.$message.error("上传视频大小不能超过100MB哦!");
        return false;
      }
    },
    uploadVideoProcess(event, file) {
      //视频上传的时候获取上传进度传给进度条
      this.videoFlag = true;
      this.videoUploadPercent = parseInt(file.percentage);
    },
    handleVideoSuccess(res) {
      //视频上传成功之后返回视频地址
      this.videoFlag = false;
      this.videoUploadPercent = 0;
      this.formVideo.video = res.result;
    },
    getShopsAll(page, page_size) {
      this.loading = true;
      var sid = this.$route.query.sid || "";
      var _this = this;
      this.$store.dispatch("getShopsAll", { page, page_size, sid });
      setTimeout(() => {
        _this.loading = false;
      }, 1000);
    },
    handleSizeChange(val) {
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      this.$store.dispatch("getShopsAll", params);
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      this.$router.push(this.$route.path + "?page=" + val);
    },
    toQualityDetails(id, title) {
      let routeData = this.$router.resolve({
        path: "/index/shop/qualitydetails",
        query: { id, title },
      });
      window.open(routeData.href, "_blank");
    },
    updateNews(id) {
      //   this.$router.push({ path: "/index/shop/addproduct", query: { id: id } });
      sessionStorage.setItem("title", this.$store.state.title);
      sessionStorage.setItem("parentTitle", this.$store.state.parentTitle);
      let routeData = this.$router.resolve({
        path: "/index/shop/addproduct",
        query: { id: id },
      });
      window.open(routeData.href, "_blank");
    },
    deleteShopItem(id) {
      this.$swal({
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = { id };
          this.$api.getShops.deleteShopItem(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal("删除成功！", "您已经删除了这条信息。", "success");
              this.$store.dispatch("getShopsAll", this.searchAll);
            } else {
              this.$fnc.alertError("删除失败！", res.data.result);
            }
          });
        }
      });
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    getIstop(val, row) {
      var params = {};
      params.id = row.id;
      params.is_top = val;
      this.$api.getShops.isTop(params).then((res) => {
        if (res.data.code == 200) {
          return;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    getIskeck(val, row) {
      var params = {};
      params.id_str = row.id;
      params.check_type = val;
      // params.is_check = val;
      // this.updata(params);
      this.$api.getShops.updateCheck(params).then((res) => {
        if (res.data.code == 200 && res.data.result) {
          this.$fnc.alertSuccess({ text: "审核成功" });
          this.$store.dispatch("getShopsAll", this.searchAll);
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    upischeckAll() {
      if (this.multipleSelection.length != 0) {
        var id_str = "";
        var params = {};
        for (var i in this.multipleSelection) {
          id_str += this.multipleSelection[i].id + "@";
        }
        params.check_type = "1";
        params.id_str = id_str;
        this.$api.getShops.updateCheck(params).then((res) => {
          if (res.data.code == 200 && res.data.result) {
            this.$fnc.alertSuccess({ text: "审核成功" });
            this.$store.dispatch("getShopsAll", this.searchAll);
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      }
    },
    upShow(show) {
      if (this.multipleSelection.length != 0) {
        var id_str = "";
        var title = show == "1" ? "上架成功" : "下架成功";
        var params = {};
        for (var i in this.multipleSelection) {
          id_str += this.multipleSelection[i].id + "@";
        }
        params.show_type = show;
        params.id_str = id_str;
        this.$api.getShops.updateAll(params).then((res) => {
          if (res.data.code == 200) {
            this.$store.dispatch("getShopsAll", this.searchAll);
            this.$fnc.alertSuccess({ text: title });
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      }
    },
    deleteLises() {
      //批量删除
      var str = "";
      if (this.multipleSelection.length <= 0) {
        this.$message.error("未选择批量删除");
      } else {
        for (var i in this.multipleSelection) {
          str += this.multipleSelection[i].id + "@";
        }
        // str = str.slice(0,-1);
        this.$swal({
          title: "您确定要删除这些信息吗",
          text: "删除后将无法恢复，请谨慎操作！",
          type: "warning",
          showCancelButton: true,
          confirmButtonColor: "#DD6B55",
          confirmButtonText: "是的，我要删除",
          cancelButtonText: "容我三思",
        }).then((willDelete) => {
          if (willDelete.value) {
            var data = { id_str: str };
            this.$api.getShops.deleteShopItemsAll(data).then((res) => {
              if (res.data.code == 200) {
                this.$swal("删除成功！", "您已经删除了这些信息。", "success");
                this.$store.dispatch("getShopsAll", this.searchAll);
              } else {
                this.$swal("删除失败！", res.data.result, "success");
              }
            });
          }
        });
      }
    },
    updata(row, title) {
      title = title || "";
      var params = {};
      params = row;
      this.$api.getShops.updataShopsItem(params).then((res) => {
        if (res.data.status == 1 && res.data.code == 200) {
          if (params.sort) {
            this.$store.dispatch("getShopsAll", this.searchAll);
          }
          if (title != "") {
            this.$fnc.alertSuccess({ text: title }); //成功弹出框
            this.$store.dispatch("getShopsAll", this.searchAll);
          }
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
          this.$store.dispatch("getShopsAll", this.searchAll);
        }
      });
    },
    getSearchShps() {
      var params = this.searchAll;
      params.page = this.$route.query.page || 1;
      params.page_size = this.pageSize;
      this.$store.dispatch("getShopsAll", params);
      this.loading = false;
      this.currentPage1 = Number(this.$route.query.page) || 1;
    },
  },
  beforeCreate() {},
  created() {
    this.searchAll.show = 1;
    if (this.$route.path.indexOf("suppliershops") >= 0) {
      this.searchAll.is_supplier = 1;
      this.item.is_supplier = 1;
    }
    this.is_cj = JSON.parse(localStorage.getItem("limit"));
    this.getSearchShps();
    this.get_activity_option();
    this.getProductList();

    this.$api.getSettings
      .findConfig({ iden: "is_lifting_stock" })
      .then((res) => {
        if (res.data.code == 200) {
          this.is_lifting_stock = res.data.result;
        }
      });
  },
  computed: {
    getMaterial() {
      return this.$store.state.shopSlist;
    },
    prodType() {
      return [
        { iden: "1", title: "出售中" },
        { iden: "2", title: "已售罄库存" },
        { iden: "3", title: "仓库中" },
        { iden: "4", title: "待审核" },
        { iden: "5", title: "驳回商品" },
        { iden: "6", title: "全部商品" },
      ];
    },
  },
  watch: {
    cate(val) {
      this.getInfo(val);
    },
    auction_open_time(val) {
      var time = val.getTime();
      this.activity_form.auction_open_time = this.$fnc.phptime(time);
    },
    delivery(val) {
      var time = val.getTime();
      this.activity_form.delivery_date = this.$fnc.phptime(time);
    },
    getMaterial(val) {
      this.list = val;
    },
    $route() {
      if (this.$route.query.page) {
        this.getSearchShps();
      }
    },
  },
};
</script>
<style lang="less" scoped></style>
